﻿@{
    Layout = "~/Views/Shared/UserLayOut.cshtml";
}


<style>
    #info_form .input { border:1px solid #ccc; width:200px; height:25px; line-height:25px;}
     #info_form  .text{ border:1px solid #ccc; width:200px; height:25px; line-height:25px;}
    #info_form select{ border:1px solid #ccc; width:100px; height:25px; line-height:25px;}
    #info_form textarea{ border:1px solid #ccc;}
    #info_form .btn_submit{ height:30px; line-height:30px; width:80px;}
</style>


            <link rel="stylesheet" href="/css/validate.css">
            <script type="text/javascript" src="/scripts/jquery/jquery.form.js"></script>
            <script type="text/javascript" src="/scripts/jquery/jquery.validate.min.js"></script>
            <script type="text/javascript" src="/scripts/jquery/messages_cn.js"></script>
            <script type="text/javascript" src="/templates/speciality/js/area.js"></script>
            <script type="text/javascript">
                function delAddress(id) {
                    if (!confirm("您确认要删除本条收货地址吗？") || id == "") {
                        return false;
                    }
                    $.ajax({
                        type: "post",
                        url: "/tools/submit_ajax.ashx?action=del_address",
                        data: { id: id },
                        dataType: "json",
                        beforeSend: function (XMLHttpRequest) {
                            //发送前动作
                        },
                        success: function (data, textStatus) {
                            if (data.msg == 1) {
                                $.ligerDialog.success(data.msgbox);
                                location.reload();
                            } else {
                                $.ligerDialog.warn(data.msgbox);
                            }
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert("状态：" + textStatus + "；出错提示：" + errorThrown);
                        },
                        timeout: 20000
                    });
                    return false;
                }
                function setDefault(id, userid) {
                    $.ajax({
                        type: "post",
                        url: "/tools/submit_ajax.ashx?action=address_setdefault",
                        data: { id: id, userid: userid },
                        dataType: "json",
                        beforeSend: function (XMLHttpRequest) {
                            //发送前动作
                        },
                        success: function (data, textStatus) {
                            if (data.msg == 1) {
                                $.ligerDialog.success(data.msgbox);
                                location.reload();
                            } else {
                                $.ligerDialog.warn(data.msgbox);
                            }
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert("状态：" + textStatus + "；出错提示：" + errorThrown);
                        },
                        timeout: 20000
                    });
                    return false;
                }
                $(function () {
                    //初始化表单
                    AjaxInitForm('info_form', 'btnSubmit', 1);
                    $("#btnSubmit").bind("click", function () {
                        if ($("#txtRealName").val() == "") {
                            $.ligerDialog.warn('对不起，请输入收货人姓名！');
                            return false;
                        }
                        if ($("#txtProvince").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属省份！');
                            return false;
                        }
                        if ($("#txtCity").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属城市！');
                            return false;
                        }
                        if ($("#txtArea").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属区域！');
                            return false;
                        }
                        if ($("#txtAddress").val() == "") {
                            $.ligerDialog.warn('对不起，请输入街道地址！');
                            return false;
                        }
                        if ($("#txtMobile").val() == "" && $("#txtPhone").val() == "") {
                            $.ligerDialog.warn('对不起，电话和手机必须选填一项！');
                            return false;
                        }

                    });
                    $("#txtProvince").change(function () {                                   //更改省份
                        change_province($(this).val());
                    });
                    $("#txtCity").change(function () {                                       //更改城市
                        change_city($(this).val());
                    });

                    load_province(22);
                    change_province(22, 234);
                    change_city(234, 0);

                });
            </script>
       <div class="right m-personal">
                <div class="status-tit">
                    <h2>
                        收货地址</h2>
                    <span></span>
                </div>
                <div class="sub-personal information clear">
                    
                    <form name="info_form" id="info_form" url="/tools/submit_ajax.ashx?action=add_address">
                    <div class="address bt20">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tbody><tr>
                                <td class="rt font_yellow2" width="15%">
                                    <b>新增收货地址</b>
                                </td>
                                <td class="lt" width="85%">
                                    电话、手机号选填一项，其余均为必选项
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    收货人姓名：
                                </td>
                                <td class="lt">
                                    <input class="atext required" name="txtRealName" id="txtRealName" type="text"><span class="font_red warn">*</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    所在地区：
                                </td>
                                <td class="lt">
                                    <select name="txtProvince" id="txtProvince">
                                        <option value="" selected="">请选择省份</option>
                                    <option value="1">北京市</option><option value="2">天津市</option><option value="3">河北省</option><option value="4">山西省</option><option value="5">内蒙古自治区</option><option value="6">辽宁省</option><option value="7">吉林省</option><option value="8">黑龙江省</option><option value="9">上海市</option><option value="10">江苏省</option><option value="11">浙江省</option><option value="12">安徽省</option><option value="13">福建省</option><option value="14">江西省</option><option value="15">山东省</option><option value="16">河南省</option><option value="17">湖北省</option><option value="18">湖南省</option><option value="19">广东省</option><option value="20">广西壮族自治区</option><option value="21">海南省</option><option value="22" selected="selected">重庆市</option><option value="23">四川省</option><option value="24">贵州省</option><option value="25">云南省</option><option value="26">西藏自治区</option><option value="27">陕西省</option><option value="28">甘肃省</option><option value="29">青海省</option><option value="30">宁夏回族自治区</option><option value="31">新疆维吾尔自治区</option><option value="32">香港特别行政区</option><option value="33">澳门特别行政区</option><option value="34">台湾省</option></select><select name="txtCity" id="txtCity">
                                    <option value="">请选择城市</option><option value="234" selected="selected">重庆市</option></select><select name="txtArea" id="txtArea">
                                    <option value="">请选择区域</option><option value="2000">万州区</option><option value="2001">涪陵区</option><option value="2002">渝中区</option><option value="2003">大渡口区</option><option value="2004">江北区</option><option value="2005">沙坪坝区</option><option value="2006">九龙坡区</option><option value="2007">南岸区</option><option value="2008">北碚区</option><option value="2009">万盛区</option><option value="2010">双桥区</option><option value="2011">渝北区</option><option value="2012">巴南区</option><option value="2013">黔江区</option><option value="2014">长寿区</option><option value="2015">綦江县</option><option value="2016">潼南县</option><option value="2017">铜梁县</option><option value="2018">大足县</option><option value="2019">荣昌县</option><option value="2020">璧山县</option><option value="2021">梁平县</option><option value="2022">城口县</option><option value="2023">丰都县</option><option value="2024">垫江县</option><option value="2025">武隆县</option><option value="2026">忠县</option><option value="2027">开县</option><option value="2028">云阳县</option><option value="2029">奉节县</option><option value="2030">巫山县</option><option value="2031">巫溪县</option><option value="2032">石柱土家族自治县</option><option value="2033">秀山土家族苗族自治县</option><option value="2034">酉阳土家族苗族自治县</option><option value="2035">彭水苗族土家族自治县</option><option value="2036">江津市</option><option value="2037">合川市</option><option value="2038">永川市</option><option value="2039">南川市</option></select><span class="font_red warn">*</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    街道地址：
                                </td>
                                <td class="lt">
                                    <textarea name="txtAddress" id="txtAddress" class="required" cols="" rows="3"></textarea><span class="font_red warn">*</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    邮政编码：
                                </td>
                                <td class="lt">
                                    <input class="text required" name="txtPostCode" id="txtPostCode" type="text"><span class="font_red warn">*</span><span class="font_gary">大陆以外地区可不填写</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    手机号码：
                                </td>
                                <td class="lt">
                                    <input class="text" name="txtMobile" id="txtMobile" type="text"><span class="font_gary">&nbsp;电话号码、手机号码必填一项</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    电话号码：
                                </td>
                                <td class="lt">
                                    <input class="text" name="txtPhone" id="txtPhone" type="text"><span class="font_gary">&nbsp;区号-电话号码-分机</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                    设为默认：
                                </td>
                                <td class="lt">
                                    <input name="txtIsDefault" type="radio" value="True" checked="">是 &nbsp;<input name="txtIsDefault" type="radio" value="False">否
                                </td>
                            </tr>
                            <tr>
                                <td class="rt">
                                </td>
                                <td class="lt">
                                    <input name="btnSubmit" id="btnSubmit" type="submit" class="btn_submit" value="确认添加">
                                </td>
                            </tr>
                        </tbody></table>
                    </div>
                    </form>
                    
                    <p class="font_yellow2 bt5">
                        <b>已保存的有效地址</b></p>
                    <div class="saveaddress bt5">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tbody><tr>
                                <th width="10%">
                                    收货人
                                </th>
                                <th width="15%">
                                    所在地区
                                </th>
                                <th width="35%">
                                    街道地址
                                </th>
                                <th width="10%">
                                    邮编
                                </th>
                                <th width="10%">
                                    电话/手机
                                </th>
                                <th width="20%">
                                    操作
                                </th>
                            </tr>
                            
                            <tr>
                                <td>
                                    <a class="font_blue" href="javascript:;">[默认]</a>&nbsp;34234
                                </td>
                                <td>
                                    <span id="p14">重庆市</span><span id="c14">重庆市</span><span id="a14">万州区</span>
                                </td>
                                <td class="lt">
                                    54325
                                </td>
                                <td>
                                    3543
                                </td>
                                <td>
                                    5345 345345
                                </td>
                                <td>
                                    <a class="font_blue" href="/user/center/address-14.aspx">修改</a>&nbsp;
                                </td>
                            </tr>
                            <script type="text/javascript">
                                load_p(22, "p14");
                                load_c(22, 234, "c14");
                                load_a(234, 2000, "a14");
                            </script>
                            
                        </tbody></table>
                    </div>
                </div>
            </div>

